<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCategoryModelsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('category_models', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title')->comment('栏目名称');
            $table->string('describe')->comment('栏目描述')->nullable();
            $table->unsignedTinyInteger('parent_id')->default(0)->comment('父栏目id');
            $table->unsignedTinyInteger('is_home')->default(0)->comment('是否是封面栏目');
            $table->string('home_template')->default('home')->comment('home模板');
            $table->string('list_template')->default('list')->comment('列表模板');
            $table->string('content_template')->default('content')->comment('内容模板');
            $table->unsignedInteger('content_model_id')->comment('栏目对应content模型的id');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('categories');
    }
}
